package com.rj.data.job.impl;

import com.google.common.collect.Lists;
import com.rj.data.entity.Job;
import com.rj.data.job.SingleThreadJob;
import com.rj.data.sink.FileSink;
import com.rj.data.sink.Sink;
import com.rj.data.source.FileSource;
import com.rj.data.source.Source;
import com.rj.data.task.impl.CnameFetchTask;
import com.rj.data.task.SynTask;

import java.util.List;

public class CNameFetcherJob extends SingleThreadJob {


    public static void main(String[] args) {
        CNameFetcherJob cNameFetcher = new CNameFetcherJob();
        cNameFetcher.jobDefine();
        cNameFetcher.execute();
    }

    @Override
    public Job jobDefine() {

        Source source = new FileSource("/data/prod/workspace/datacenter/mysql-files/company-base-jh-ALL-2.txt");
        Sink<List<String>> sink = new FileSink("/data/prod/workspace/datacenter/mysql-files/company-base-name.txt",100000);
//        Sink<List<String>> sink = new FileSink("");

        List<Sink> sinks = Lists.newArrayList(sink);
        SynTask task = new CnameFetchTask(source, sinks);
        this.tasks.add(task);
        return null;
    }
}
